<?php

class ZendBlog_Validate_Password extends Zend_Validate_Abstract {
    const NOT_MATCH = 'notMatch';

    protected $_messageTemplates = array(
        self::NOT_MATCH => 'Password confirmation does not match'
    );

    public function isValid($value) {
        $tableUsers = new Application_Model_DbTable_Users();
        $row = $tableUsers->find(Zend_Auth::getInstance()->getIdentity()->id);
        if (hash('SHA256', $value) == $row->current()->password)
            return true;

        $this->_error(self::NOT_MATCH);
        return false;
    }

}